import {request} from "vendor/utils/T";
import {toApi} from '@/service/proxyApi';
import { RespSysSettingDataType, RequestSysSettingDataType } from "./apiType";

export * from "./apiType";

const { postJSON, get, mkRespData, mockRespData } = request;

export const getAllSysPostList = () => get<RespSysSettingDataType.SysPost[]>(toApi("system/post/optionselect"));

export const getAllSysRoleList = () => get<RespSysSettingDataType.SysRole[]>(toApi("system/role/optionselect"));

export const getOrgTreeSelect = () => get<RespSysSettingDataType.TreeSelectData[]>(toApi("system/dept/treeSelectData"));

/**
 * 获取组织树
 */
export const getOrgTreeData = (params: {deptName?: string} = {}) => get<RespSysSettingDataType.DeptTreeNode[]>(toApi("system/dept/treeData"), params);

/**
 * 依据登录用户获取组织树
 */
export const getOrgTreeByLoginUser = (params: {deptName?: string} = {}) => get<RespSysSettingDataType.DeptTree>(toApi("system/dept/current/tree"), params);

/**
 * 获取组织详情
 */
export const getOrgDetail = (deptId: string) => {
    return get<RespSysSettingDataType.DeptItemInfo>(toApi("system/dept/" + deptId));
}

